#lang rosetta-racket


; (backend autocad 'delete)

(require rosetta-distros/autocad-render)
(backend autocad 'delete)

;(backend-autocad-template)


(define sph-r 0.05)
(define min-r 0.01)
(define min-h 0.01)

(define (my-cylinder c r h)
  (cond ((and (= r 0) (= h 0))
         (sphere c sph-r))
        (else
         (let ((r (if (= r 0) min-r r))
               (h (if (= h 0) min-h h)))
           (cylinder c r h)))))


(define (cylinders y cx dx r dr h dh n)
  (for/list ((cx (: < cx .. dx .. < n > >))
             (cr (: < r .. dr .. < n > >))
             (ch (: < h .. dh .. < n > >)))
    (my-cylinder (xy cx y) cr ch)))

(cylinders 0 0 2 1 0 0 0.5 5)
(cylinders 2 0 2 0 0.2 2 0 5)
(cylinders 4 0 2 0 0.2 0 0.5 5)